class Enemy:
    def __init__(self, name, attack, blood,age):
        self.__name = name
        self.__attack = attack
        self.__blood = blood
        self.__age=age

    @property
    def age(self):
        return self.__age

    @age.setter
    def age(self, value):
        if self.__age > 100 or self.__age < 0:
            print("年龄不合法!")
        else:
            self.__age = value

    @property
    def name(self):
        return self.__name
    @property
    def attack(self):
        return self.__attack

    @attack.setter
    def attack(self, value):
        if self.__attack > 100 or self.__attack < 0:
            print("攻击不合法!")
        else:
            self.__attack = value

    @property
    def blood(self):
        return self.__blood

    @blood.setter
    def blood(self, value):
        if self.__blood > 100 or self.__blood < 0:
            print("血量不合法!")
        else:
            self.__blood = value


e1 = Enemy("灭霸", 199, 200)
print(e1.attack)
